/**
 */
package com.my.sl.emfresource.webpage.impl;

import com.my.sl.emfresource.webpage.MyWeb;
import com.my.sl.emfresource.webpage.Webpage;
import com.my.sl.emfresource.webpage.WebpagePackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>My Web</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link com.my.sl.emfresource.webpage.impl.MyWebImpl#getName <em>Name</em>}</li>
 *   <li>{@link com.my.sl.emfresource.webpage.impl.MyWebImpl#getTitle <em>Title</em>}</li>
 *   <li>{@link com.my.sl.emfresource.webpage.impl.MyWebImpl#getDescription <em>Description</em>}</li>
 *   <li>{@link com.my.sl.emfresource.webpage.impl.MyWebImpl#getKeywords <em>Keywords</em>}</li>
 *   <li>{@link com.my.sl.emfresource.webpage.impl.MyWebImpl#getPages <em>Pages</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MyWebImpl extends EObjectImpl implements MyWeb {
   /**
    * The default value of the '{@link #getName() <em>Name</em>}' attribute.
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @see #getName()
    * @generated
    * @ordered
    */
   protected static final String NAME_EDEFAULT = null;

   /**
    * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @see #getName()
    * @generated
    * @ordered
    */
   protected String name = NAME_EDEFAULT;

   /**
    * The default value of the '{@link #getTitle() <em>Title</em>}' attribute.
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @see #getTitle()
    * @generated
    * @ordered
    */
   protected static final String TITLE_EDEFAULT = "";

   /**
    * The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @see #getTitle()
    * @generated
    * @ordered
    */
   protected String title = TITLE_EDEFAULT;

   /**
    * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @see #getDescription()
    * @generated
    * @ordered
    */
   protected static final String DESCRIPTION_EDEFAULT = null;

   /**
    * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @see #getDescription()
    * @generated
    * @ordered
    */
   protected String description = DESCRIPTION_EDEFAULT;

   /**
    * The default value of the '{@link #getKeywords() <em>Keywords</em>}' attribute.
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @see #getKeywords()
    * @generated
    * @ordered
    */
   protected static final String KEYWORDS_EDEFAULT = null;

   /**
    * The cached value of the '{@link #getKeywords() <em>Keywords</em>}' attribute.
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @see #getKeywords()
    * @generated
    * @ordered
    */
   protected String keywords = KEYWORDS_EDEFAULT;

   /**
    * The cached value of the '{@link #getPages() <em>Pages</em>}' containment reference list.
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @see #getPages()
    * @generated
    * @ordered
    */
   protected EList<Webpage> pages;

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   protected MyWebImpl() {
      super();
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   @Override
   protected EClass eStaticClass() {
      return WebpagePackage.Literals.MY_WEB;
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   public String getName() {
      return name;
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   public void setName(String newName) {
      String oldName = name;
      name = newName;
      if (eNotificationRequired())
         eNotify(new ENotificationImpl(this, Notification.SET, WebpagePackage.MY_WEB__NAME, oldName, name));
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   public String getTitle() {
      return title;
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   public void setTitle(String newTitle) {
      String oldTitle = title;
      title = newTitle;
      if (eNotificationRequired())
         eNotify(new ENotificationImpl(this, Notification.SET, WebpagePackage.MY_WEB__TITLE, oldTitle, title));
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   public String getDescription() {
      return description;
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   public void setDescription(String newDescription) {
      String oldDescription = description;
      description = newDescription;
      if (eNotificationRequired())
         eNotify(new ENotificationImpl(this, Notification.SET, WebpagePackage.MY_WEB__DESCRIPTION, oldDescription, description));
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   public String getKeywords() {
      return keywords;
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   public void setKeywords(String newKeywords) {
      String oldKeywords = keywords;
      keywords = newKeywords;
      if (eNotificationRequired())
         eNotify(new ENotificationImpl(this, Notification.SET, WebpagePackage.MY_WEB__KEYWORDS, oldKeywords, keywords));
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   public EList<Webpage> getPages() {
      if (pages == null) {
         pages = new EObjectContainmentEList<Webpage>(Webpage.class, this, WebpagePackage.MY_WEB__PAGES);
      }
      return pages;
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   @Override
   public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
      switch (featureID) {
         case WebpagePackage.MY_WEB__PAGES:
            return ((InternalEList<?>)getPages()).basicRemove(otherEnd, msgs);
      }
      return super.eInverseRemove(otherEnd, featureID, msgs);
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   @Override
   public Object eGet(int featureID, boolean resolve, boolean coreType) {
      switch (featureID) {
         case WebpagePackage.MY_WEB__NAME:
            return getName();
         case WebpagePackage.MY_WEB__TITLE:
            return getTitle();
         case WebpagePackage.MY_WEB__DESCRIPTION:
            return getDescription();
         case WebpagePackage.MY_WEB__KEYWORDS:
            return getKeywords();
         case WebpagePackage.MY_WEB__PAGES:
            return getPages();
      }
      return super.eGet(featureID, resolve, coreType);
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   @SuppressWarnings("unchecked")
   @Override
   public void eSet(int featureID, Object newValue) {
      switch (featureID) {
         case WebpagePackage.MY_WEB__NAME:
            setName((String)newValue);
            return;
         case WebpagePackage.MY_WEB__TITLE:
            setTitle((String)newValue);
            return;
         case WebpagePackage.MY_WEB__DESCRIPTION:
            setDescription((String)newValue);
            return;
         case WebpagePackage.MY_WEB__KEYWORDS:
            setKeywords((String)newValue);
            return;
         case WebpagePackage.MY_WEB__PAGES:
            getPages().clear();
            getPages().addAll((Collection<? extends Webpage>)newValue);
            return;
      }
      super.eSet(featureID, newValue);
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   @Override
   public void eUnset(int featureID) {
      switch (featureID) {
         case WebpagePackage.MY_WEB__NAME:
            setName(NAME_EDEFAULT);
            return;
         case WebpagePackage.MY_WEB__TITLE:
            setTitle(TITLE_EDEFAULT);
            return;
         case WebpagePackage.MY_WEB__DESCRIPTION:
            setDescription(DESCRIPTION_EDEFAULT);
            return;
         case WebpagePackage.MY_WEB__KEYWORDS:
            setKeywords(KEYWORDS_EDEFAULT);
            return;
         case WebpagePackage.MY_WEB__PAGES:
            getPages().clear();
            return;
      }
      super.eUnset(featureID);
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   @Override
   public boolean eIsSet(int featureID) {
      switch (featureID) {
         case WebpagePackage.MY_WEB__NAME:
            return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
         case WebpagePackage.MY_WEB__TITLE:
            return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title);
         case WebpagePackage.MY_WEB__DESCRIPTION:
            return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
         case WebpagePackage.MY_WEB__KEYWORDS:
            return KEYWORDS_EDEFAULT == null ? keywords != null : !KEYWORDS_EDEFAULT.equals(keywords);
         case WebpagePackage.MY_WEB__PAGES:
            return pages != null && !pages.isEmpty();
      }
      return super.eIsSet(featureID);
   }

   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @generated
    */
   @Override
   public String toString() {
      if (eIsProxy()) return super.toString();

      StringBuffer result = new StringBuffer(super.toString());
      result.append(" (name: ");
      result.append(name);
      result.append(", title: ");
      result.append(title);
      result.append(", description: ");
      result.append(description);
      result.append(", keywords: ");
      result.append(keywords);
      result.append(')');
      return result.toString();
   }

} //MyWebImpl
